import {
  DashboardOutlined,
  BankOutlined,
  SettingOutlined,
} from '@ant-design/icons'
import withLoadable from '../utils/with-loadable'
// import Login from '../views/login'
// import Dashboard from '../views/dashboard'
// import FrameLayout from '../layout/frame-layout'
// import Hospital from '../views/hospital'
// import Doctor from '../views/hospital/doctor/doctor'
// import DoctorEdit from '../views/hospital/doctor/edit'
// import Department from '../views/hospital/department'
// import Introduction from '../views/hospital/introduction'
// import Map from '../views/dashboard/map'

// 路由懒加载（分片打包）处理
const Login = withLoadable(() => import('../views/login'))
const Dashboard = withLoadable(() => import('../views/dashboard'))
const FrameLayout = withLoadable(() => import('../layout/frame-layout'))
const Hospital = withLoadable(() => import('../views/hospital'))
const Doctor = withLoadable(() => import('../views/hospital/doctor/doctor'))
const DoctorEdit = withLoadable(() => import('../views/hospital/doctor/edit'))
const Department = withLoadable(() => import('../views/hospital/department'))
const Introduction = withLoadable(() => import('../views/hospital/introduction'))
const System = withLoadable(() => import('../views/system'))
const Profile = withLoadable(() => import('../views/system/profile'))
const ChangePassword = withLoadable(() => import('../views/system/change-password'))
const Setting = withLoadable(() => import('../views/system/setting'))
const Map = withLoadable(() => import('../views/dashboard/map'))

const routes = [
  {
    path: '/login',
    component: Login,
    exact: true,
  },
  {
    path: '/',
    component: FrameLayout,
    children: [
      {
        path: '/dashboard',
        component: Dashboard,
        meta: {
          title: '首页',
          icon: DashboardOutlined,
        },
      },
      {
        path: '/map',
        component: Map,
        meta: {
          title: '疫情地图',
          icon: DashboardOutlined,
        },
      },
      {
        path: '/hospital',
        component: Hospital,
        meta: {
          title: '医院信息',
          icon: BankOutlined,
        },
        children: [
          {
            path: '/hospital/doctor',
            component: Doctor,
            exact: true,
            meta: {
              title: '医生管理',
            },
          },
          {
            path: '/hospital/doctor/edit',
            component: DoctorEdit,
            meta: {
              title: '编辑医生',
              exclude: true, // 排除，不在菜单中显示
            },
          },
          {
            path: '/hospital/department',
            component: Department,
            meta: {
              title: '科室管理',
            },
          },
          {
            path: '/hospital/introduction',
            component: Introduction,
            meta: {
              title: '医院介绍',
            },
          },
        ],
      },
      {
        path: '/system',
        component: System,
        meta: {
          title: '系统管理',
          icon: SettingOutlined,
        },
        children: [
          {
            path: '/system/setting',
            component: Setting,
            meta: {
              title: '系统设置',
            },
          },
          {
            path: '/system/profile',
            component: Profile,
            meta: {
              title: '个人中心',
            },
          },
          {
            path: '/system/pass',
            component: ChangePassword,
            meta: {
              title: '修改密码',
            },
          },
        ],
      },
    ],
  },
]

export default routes
